#pragma once
#include "../Kernel.h"

struct DeviceCfg
{
	DeviceCfg()
	{
		memset(this,0,sizeof(DeviceCfg));
		mIsWindowed			= true;
		mMultiSampleType	= D3DMULTISAMPLE_NONE;
	}
	bool					mIsWindowed;
	unsigned int 			mWidth;
	unsigned int 			mHeight;
	unsigned int 			mFullScreenHZ;
	HWND		 			mWnd;
	bool		 			mIsVerticalSync;
	D3DMULTISAMPLE_TYPE		mMultiSampleType;
};

class D3Device 
{
public:
	D3Device();
	~D3Device();

	static const DWORD MINI_VSVERSION=D3DVS_VERSION(1,1);	//vertex shader version required
	static const DWORD MINI_PSVERSION=D3DPS_VERSION(1,4);	//pixel shader version required

public:
	IDirect3DDevice9*	createDevice(const DeviceCfg& cfg);

private:
	DWORD findBestBehaviorFlags();
	void  findBestPresentParam(const DeviceCfg& cfg,D3DPRESENT_PARAMETERS& pParam);

private:
	IDirect3D9*			mDevice;
	IDirect3DDevice9*	mD3DDevice;	


};